package hocusPocus.IHM;

import hocusPocus.Controllers.ControllerTypeDePartie;

import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JRadioButton;
import javax.swing.WindowConstants;
import java.awt.Toolkit;

public class TypeDePartie extends JDialog {
	private static final long serialVersionUID = 1L;
	public static boolean partieNormale = true;
	public static boolean partieRapide = false;
	public JRadioButton normale;
	public JRadioButton rapide;
	public ButtonGroup group;
	public JButton ok;
	public JButton annuler;
	

	
	
	/**
	 * Creer la fenetre qui permet de selectionner le 
	 * type de partie: normale ou rapide
	 */
	public TypeDePartie(){
		setIconImage(Toolkit.getDefaultToolkit().getImage(TypeDePartie.class.getResource("/images/icone.gif")));
		setResizable(false);
		setTitle("Hocus Pocus");
		
		
		ControllerTypeDePartie controleTypeDePartie = new ControllerTypeDePartie(this);
		this.setBounds(100, 100, 299, 207);
		this.setLocationRelativeTo(this.getParent());
		this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
		this.getContentPane().setLayout(null);
		JLabel label = new JLabel("Type de partie : ");
		label.setBounds(22, 11, 178, 14);
		this.getContentPane().add(label);

		group = new ButtonGroup();
		normale = new JRadioButton("Normale");
		normale.setBounds(97, 37, 109, 23);
		normale.setSelected(true);
		normale.addActionListener(controleTypeDePartie);
		this.getContentPane().add(normale);

		rapide= new JRadioButton("Rapide");
		rapide.setBounds(97, 74, 109, 23);
		rapide.addActionListener(controleTypeDePartie);
		this.getContentPane().add(rapide);

		group.add(normale);
		group.add(rapide);

		ok = new JButton("OK");
		ok.setBounds(47, 133, 89, 23);
		ok.addActionListener(controleTypeDePartie);

		this.getContentPane().add(ok);

		annuler = new JButton("Annuler");
		annuler.setBounds(165, 133, 89, 23);
		this.getContentPane().add(annuler);
		annuler.addActionListener(controleTypeDePartie);
		this.setVisible(true);
	}
}
